package communication;
import information.Pacman;
import information.PacmanObserver;
import exceptions.NotImplementedException;

import util.Coordinaat;
import util.StringUtils;

/**
 * This class is responsible for sending the new
 * information about pacman.
 * 
 * @author	Daan Wendelen
 */
public class PacmanProtocol extends Protocol implements PacmanObserver{

	/**
	 * Creates a new PacmanProtocol for pacman.
	 * 
	 * @throws	NullPointerException
	 * 			pacman == null
	 */
	public PacmanProtocol(Pacman pacman)
	{
		pacman.attach(this);
	}
	
	@Override
	public void pacmanMoved(Coordinaat newLocation) {
		String positionString = new StringUtils().coordinaatToString(newLocation);
		
		getKanaal().stuurBericht(("pacman POSITION " + positionString + "\n").getBytes());
	}

	@Override
	public void verwerkInkomend(byte[] bytes) {		
	}

}
